<template>
    <div  >
        <div class="card tr mb2">
      
        <el-button size="mini" type="primary" icon="el-icon-plus" @click="submit">提交</el-button>
      <!-- <el-button type="danger" icon="el-icon-remove" @click="deleteByIds">删除</el-button> -->
        </div>
      <div>
        <el-form :model="ruleForm" ref="ruleForm" label-width="140px" class="demo-ruleForm" size="mini" inline>
            <my-form-item v-for="item in list" :label="item.name" :key="item.id">
                <el-input v-model="ruleForm[item.value]"></el-input>
            </my-form-item>
        </el-form>
    </div>
    </div>
  </template>
  
  <script>

    export default {
      components: { },
      data() {
        return {
            list:[],
            ruleForm:{},
        };
          
    },
  
    mounted() {
        this.innit();
    },
    computed: {
    },
   
    methods: {
        submit(){
            let user=JSON.parse(sessionStorage.getItem("user"));
            let params={
                userName:user.realName,
                userId:user.id,
                modelId:this.$route.query.modelId,
                formInfo:JSON.stringify(this.list),
                businessInfo:JSON.stringify(this.ruleForm)
                }
            this.$api
          .formPost("/api/flowact/flow/submit", params)
          .then(res => {
            if (res.retHead.code == "0000000") {
                this.$message({
                    message:"提交成功",
                    type: "success"
                  });
                  this.$router.push("/activity/apply");
            }else{
              this.$message({
                    message:res.retHead.message,
                    type: "error"
                  });
            }
          });
        },
        innit(){
            let params={modelId:this.$route.query.modelId}
            this.$api
          .formPost("/api/flowact/commTaskForm/findListByModelId", params)
          .then(res => {
            if (res.retHead.code == "0000000") {
                this.list=res.retBody;
            }else{
              this.$message({
                    message:res.retHead.message,
                    type: "error"
                  });
            }
          });
        }
    },
    created() { }
  };
  </script>
  <style lang='scss' scoped>
  
  </style>